#!/bin/bash
#instance1
case "$1" in
1)
	. /etc/init.d/functions
	export CATALINA_BASE="/usr/local/tomcat/instance1"
	case "$2" in
	start)
		$CATALINA_HOME/bin/startup.sh
	;;
	stop)
		$CATALINA_HOME/bin/shutdown.sh
	;;
	restart)
		$CATALINA_HOME/bin/shutdown.sh
        	sleep 5
        	$CATALINA_HOME/bin/startup.sh
	;;
	esac
;;
2)
	. /etc/init.d/functions
        export CATALINA_BASE="/usr/local/tomcat/instance2"
        case "$2" in
        start)
                $CATALINA_HOME/bin/startup.sh
        ;;
        stop)
                $CATALINA_HOME/bin/shutdown.sh
        ;;
        restart)
                $CATALINA_HOME/bin/shutdown.sh
                sleep 5
                $CATALINA_HOME/bin/startup.sh
        ;;
        esac
;;
3)
	. /etc/init.d/functions
        export CATALINA_BASE="/usr/local/tomcat/instance3"
        case "$2" in
        start)
                $CATALINA_HOME/bin/startup.sh
        ;;
        stop)
                $CATALINA_HOME/bin/shutdown.sh
        ;;
        restart)
                $CATALINA_HOME/bin/shutdown.sh
                sleep 5
                $CATALINA_HOME/bin/startup.sh
        ;;
        esac
;;
esac
export JAVA_OPTS='-Xms64m -Xmx128m'
